﻿// =================================================================== 
// 项目说明
//====================================================================
// 文件： ERP_RetuenCargoDetail.cs
// 创建时间：2016/11/30
// 负责人：
// ===================================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using CRMMis.Model;
using CRMMis.IDAL;


namespace MSSQLDAL
{
    /// <summary>
    /// 数据层实例化接口类  退货详情表.
    /// </summary>
    public partial class ERP_RetuenCargoDetailDAL : IERP_RetuenCargoDetailDAL
    {
		//此处写查询数据的sql语句，


        //if QueryDataString==""，DAL层的GetList，GetRecordCount等函数将直接存取ERP_RetuenCargoDetail表


        //if QueryDataString!=""，则DAL层的GetList，GetRecordCount等函数将存取该SQL语句，取代表
		//注意：所写sql语句执行结果的字段必须是唯一的

		private const string QueryDataString = @"select c.*,
a.CargoId,a.SupplyId,a.Supplyprice,b.CargoName,
b.Spell,b.ByName,b.CargoCode,b.Spec,b.Version,b.ProduceName,b.Area,b.Unit,
d.StoreRoomId,e.BatchNo,
(select SupplyName from ERP_Supply where SupplyID=a.SupplyID )  SupplyName,
(select TYPE_NAME from ERP_Type where TYPE_ID=b.TypeId )  TypeName,
(select Use_NAME from ERP_Use where Use_ID=b.UseId )  UseNAME,
(a.Supplyprice * c.Count) TotalPrice
from ERP_RetuenCargoDetail c
inner join ERP_RetuenCargo d on c.DReturnID = d.ReturnID
inner join ERP_StockDetail e on e.ItemId = c.ItemId
inner join ERP_StockInfo f on f.StoreId = e.StoreId
inner join  ERP_Cargo_Detail a on a.DetailId=f.DetailId
inner join ERP_Cargo b on a.CargoId=b.CargoId  ";
	}
}
